
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <cmath>
#include <chrono>

#include <lurpc/core/rpc_core.h>


namespace tmp_kv_client {

void client_test() {
    lurpc::socket_client cli {};
    cli.connect_to_server(4399, "127.0.0.1");
    cli.remote_call<int, std::string, std::string>(101, "name", "tom");
    std::cout << cli.remote_call<std::string, std::string>(102, "name") << std::endl;
    cli.remote_call<int, std::string>(103, "name");
    cli.close_conn();
}

void benchmark_001(int cnt) {
    std::vector<std::string> ss(cnt);
    for (int i = 0; i < cnt; i++) {
        ss[i] = std::to_string(i);
    }

    lurpc::socket_client cli {};
    cli.connect_to_server(4399, "127.0.0.1");

    std::cout << "begin..." << std::endl;
    auto st = std::chrono::high_resolution_clock::now();

    //

    auto ed = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> elapsed = ed - st;
    std::cout << elapsed.count() << std::endl;
}

}

int main(int argc, char** argv) {

    lurpc::rpc_services::load_from_file("/Users/lufeifan/CLionProjects/lurpc/config/services");

//    tmp_kv_client::benchmark_001(100);
    tmp_kv_client::client_test();

    return 0;
}
